﻿#region Copyright 
/*-------------------------------------------------------------------------
* 命名空间名称/文件名:    SSPivot.Admin.Core.Service.sys.Role/ISysRoleService 
* CLR版本:     4.0.30319.42000
* 机器名称:    DESKTOP-NHMLO8A
* 功 能：       N/A
* 类 名：       ISysRoleService
* 创建时间：  2025/6/4 16:09:01
* 版本号：      v1.0
* 创建人:        xulong
*-------------------------------------------------------------------------*/
#endregion  
using SSPivot.Admin.Core.Service.sys.Permission.Dto;
using SSPivot.Admin.Core.Service.sys.Role.Dto;
using SSPivot.AspNetCore.Services;
using SSPivot.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SSPivot.Admin.Core.Service.sys.Role
{
    /// <summary>
    /// 角色服务
    /// </summary>
    public interface ISysRoleService : IApplicationService
    {
        #region 服务


        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<SysRoleDto> GetAsync(long id);
        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<List<RoleGetListDto>> GetListAsync(QuerySysRoleRequest model);

        /// <summary>
        /// 查询分页
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<(List<RoleGetPageDto>, PageResult)> GetPageAsync(QuerySysRoleRequest model, PageResult page);

        /// <summary>
        /// 查询角色用户列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<List<RoleGetUserListDto>> GetRoleUserListAsync(QueryRoleGetUserRequset model);

        /// <summary>
        /// 添加角色用户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task AddRoleUserAsync(RoleAddUserListDto model);

        /// <summary>
        /// 移除角色用户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns> 
        Task RemoveRoleUserAsync(RoleAddUserListDto model);

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<long> AddAsync(SysRoleDto model);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task UpdateAsync(SysRoleDto model);
        /// <summary>
        /// 彻底删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns> 
        Task DeleteAsync(long id);

        /// <summary>
        /// 批量彻底删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>       
        Task BatchDeleteAsync(long[] ids);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>     
        Task SoftDeleteAsync(long id);

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>     
        Task BatchSoftDeleteAsync(long[] ids);
        /// <summary>
        /// 设置数据权限
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task SetDataScopeAsync(RoleSetDataScopeDto model);
        #endregion

        #region tree

        /// <summary>
        /// 获得本级和下级Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<List<long>> GetChildrenIdListAsync(long id);

        /// <summary>
        /// 获取上级
        /// </summary>
        /// <param name="departmentId"></param>
        /// <returns></returns>
        Task<List<SysRoleDto>> GetSupCategory(long id);

        /// <summary>
        /// 获取上级名称
        /// </summary>
        /// <param name="departmentId"></param>
        /// <returns></returns>
        Task<List<string>> GetSupCategoryName(long id);

        /// <summary>
        /// 获取下级部门带层级
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<List<SysRoleDto>> GetSubCategoryTreeAsync(QuerySysRoleRequest model);

        /// <summary>
        /// 获取类别tree
        /// </summary>
        /// <returns></returns>
        Task<List<SysRoleDto>> GetAllDataTreeAsync(QuerySysRoleRequest model);
        /// <summary>
        /// 递归获取所有子级部门及层级
        /// </summary>
        /// <param name="model"></param>
        SysRoleDto RecursionCategory(SysRoleDto model, List<SysRoleDto> allData);
        #endregion
    }
}
